package com.zhuss.order.processor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import com.zhuss.bean.bo.order.order.CreateOrderItemBo;
import com.zhuss.common.AbstractProcessor;
import com.zhuss.common.Processor;
import com.zhuss.exception.DzcxException;
import com.zhuss.order.db.dao.ext.OrderItemDao;
import com.zhuss.order.db.entity.OrderItem;


/**
 * @description: 订单明细创建
 * @author: zhushanshuo
 * @create: Tue Jan 12 13:51:36 CST 2021
 **/
@Component("orderItemCreate")
public class OrderItemCreate extends AbstractProcessor<Object, CreateOrderItemBo> implements Processor<Object, CreateOrderItemBo> {

    @Autowired
    private OrderItemDao orderItemDao;
    
    @Autowired
	@Qualifier("orderItemRead")
	private OrderItemRead orderItemRead;
    
    
    /**
     * 校验
     */
    @Override
    public void check(CreateOrderItemBo bo) throws DzcxException {
    }
    
    /**
     * 操作方法
     */
    @Override
    public Object process(CreateOrderItemBo param) {
    	OrderItem record = new OrderItem();
    	record.setOrderId(param.getOrderId());
    	record.setLineStrategyId(param.getLineStrategyId());
    	record.setTrainId(param.getTrainId());
    	record.setStartTime(param.getStartTime());
    	record.setPersonNum(param.getPersonNum());
    	record.setPrice(param.getPrice());
    	record.setRefundPrice(param.getRefundPrice());
    	record.setRefundPercent(param.getRefundPercent());
    	record.setDate(param.getDate());
    	record.setStatus(param.getStatus());
    	record.setOnSiteId(param.getOnSiteId());
    	record.setOnSiteName(param.getOnSiteName());
    	record.setOnSiteTime(param.getOnSiteTime());
    	record.setOffSiteId(param.getOffSiteId());
    	record.setOffSiteName(param.getOffSiteName());
    	record.setOffSiteTime(param.getOffSiteTime());
    	
    	record.setCreatorId(param.getConcurrentUserId());
    	record.setCreator(param.getConcurrentUserName());
    	record.setCreateTime(param.getCreateTime());
    	orderItemDao.create(record);
    	param.setTargetId(record.getOrderItemId());
        return null;
    }
    
    /**
     * 操作日志
     */
	@Override
	public Object log(CreateOrderItemBo param) throws DzcxException {
		return null;
	}
}
